<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCatearrsTable extends Migration
{
    //提交
    public function up()
    {
        Schema::create('catearrs', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->unsignedInteger('cid')->comment('分类id');
            $table->unsignedInteger('aid')->comment('属性id');
            $table->foreign('cid')
                ->references('id')->on('categos')
                ->onDelete('cascade');
            $table->foreign('aid')
                ->references('id')->on('arrs')
                ->onDelete('cascade');
        });
    }

    //回滚
    public function down()
    {
        Schema::dropIfExists('catearrs');
    }
}
